/*
 * Copyright (c) 2024, MediaTek Inc. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef MT_GPIO_H
#define MT_GPIO_H

#include <mtgpio_common.h>

/* Enumeration for GPIO pin */
typedef enum GPIO_PIN {
	GPIO_UNSUPPORTED = -1,
	GPIO0, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6,
	GPIO7, GPIO8, GPIO9, GPIO10, GPIO11, GPIO12, GPIO13, GPIO14,
	GPIO15, GPIO16, GPIO17, GPIO18, GPIO19, GPIO20, GPIO21, GPIO22,
	GPIO23, GPIO24, GPIO25, GPIO26, GPIO27, GPIO28, GPIO29, GPIO30,
	GPIO31, GPIO32, GPIO33, GPIO34, GPIO35, GPIO36, GPIO37, GPIO38,
	GPIO39, GPIO40, GPIO41, GPIO42, GPIO43, GPIO44, GPIO45, GPIO46,
	GPIO47, GPIO48, GPIO49, GPIO50, GPIO51, GPIO52, GPIO53, GPIO54,
	GPIO55, GPIO56, GPIO57, GPIO58, GPIO59, GPIO60, GPIO61, GPIO62,
	GPIO63, GPIO64, GPIO65, GPIO66, GPIO67, GPIO68, GPIO69, GPIO70,
	GPIO71, GPIO72, GPIO73, GPIO74, GPIO75, GPIO76, GPIO77, GPIO78,
	GPIO79, GPIO80, GPIO81, GPIO82, GPIO83, GPIO84, GPIO85, GPIO86,
	GPIO87, GPIO88, GPIO89, GPIO90, GPIO91, GPIO92, GPIO93, GPIO94,
	GPIO95, GPIO96, GPIO97, GPIO98, GPIO99, GPIO100, GPIO101, GPIO102,
	GPIO103, GPIO104, GPIO105, GPIO106, GPIO107, GPIO108, GPIO109, GPIO110,
	GPIO111, GPIO112, GPIO113, GPIO114, GPIO115, GPIO116, GPIO117, GPIO118,
	GPIO119, GPIO120, GPIO121, GPIO122, GPIO123, GPIO124, GPIO125, GPIO126,
	GPIO127, GPIO128, GPIO129, GPIO130, GPIO131, GPIO132, GPIO133, GPIO134,
	GPIO135, GPIO136, GPIO137, GPIO138, GPIO139, GPIO140, GPIO141, GPIO142,
	GPIO143, GPIO144, GPIO145, GPIO146, GPIO147, GPIO148, GPIO149, GPIO150,
	GPIO151, GPIO152, GPIO153, GPIO154, GPIO155, GPIO156, GPIO157, GPIO158,
	GPIO159, GPIO160, GPIO161, GPIO162, GPIO163, GPIO164, GPIO165, GPIO166,
	GPIO167, GPIO168, GPIO169, GPIO170, GPIO171, GPIO172, GPIO173, GPIO174,
	GPIO175, GPIO176, GPIO177, GPIO178, GPIO179, GPIO180, GPIO181, GPIO182,
	GPIO183, GPIO184, GPIO185, GPIO186, GPIO187, GPIO188, GPIO189, GPIO190,
	GPIO191, GPIO192, GPIO193, GPIO194, GPIO195, GPIO196, GPIO197, GPIO198,
	GPIO199, GPIO200, GPIO201, GPIO202, GPIO203, GPIO204, GPIO205, GPIO206,
	GPIO207, GPIO208, GPIO209, GPIO210, GPIO211, GPIO212, GPIO213, GPIO214,
	GPIO215, GPIO216, GPIO217, GPIO218, GPIO219, GPIO220, GPIO221, GPIO222,
	GPIO223, GPIO224, GPIO225, GPIO226, GPIO227, GPIO228, GPIO229, GPIO230,
	GPIO231, GPIO232, GPIO233, GPIO234, GPIO235, GPIO236, GPIO237, GPIO238,
	GPIO239, GPIO240, GPIO241, GPIO242, GPIO243, GPIO244, GPIO245, GPIO246,
	GPIO247, GPIO248, GPIO249, GPIO250, GPIO251, GPIO252, GPIO253, GPIO254,
	GPIO255, GPIO256, GPIO257, GPIO258, GPIO259, GPIO260, GPIO261, GPIO262,
	GPIO263, GPIO264, GPIO265, GPIO266, GPIO267, GPIO268, GPIO269, GPIO270,
	MT_GPIO_BASE_MAX
} GPIO_PIN;

static const struct mt_pin_info mt_pin_infos[] = {
	PIN(0, 0, 0, 0x18, 0x90),
	PIN(1, 0, 1, 0x18, 0x90),
	PIN(2, 0, 1, 0x1b, 0x70),
	PIN(3, 0, 2, 0x1b, 0x70),
	PIN(4, 0, 3, 0x1b, 0x70),
	PIN(5, 0, 4, 0x1b, 0x70),
	PIN(6, 0, 5, 0x1b, 0x70),
	PIN(7, 0, 6, 0x1b, 0x70),
	PIN(8, 0, 7, 0x1b, 0x70),
	PIN(9, 0, 14, 0x29, 0xa0),
	PIN(10, 0, 12, 0x29, 0xa0),
	PIN(11, 0, 2, 0x18, 0x90),
	PIN(12, 0, 13, 0x29, 0xa0),
	PIN(13, 0, 1, 0x26, 0x90),
	PIN(14, 0, 0, 0x13, 0x80),
	PIN(15, 0, 2, 0x26, 0x90),
	PIN(16, 0, 3, 0x26, 0x90),
	PIN(17, 0, 4, 0x26, 0x90),
	PIN(18, 0, 5, 0x26, 0x90),
	PIN(19, 0, 6, 0x26, 0x90),
	PIN(20, 0, 1, 0x13, 0x80),
	PIN(21, 0, 3, 0x12, 0x80),
	PIN(22, 0, 4, 0x12, 0x80),
	PIN(23, 0, 5, 0x12, 0x80),
	PIN(24, 0, 6, 0x12, 0x80),
	PIN(25, 0, 7, 0x12, 0x80),
	PIN(26, 0, 8, 0x12, 0x80),
	PIN(27, 0, 9, 0x12, 0x80),
	PIN(28, 0, 10, 0x12, 0x80),
	PIN(29, 0, 11, 0x12, 0x80),
	PIN(30, 0, 12, 0x12, 0x80),
	PIN(31, 0, 13, 0x12, 0x80),
	PIN(32, 0, 8, 0x11, 0x80),
	PIN(33, 0, 9, 0x11, 0x80),
	PIN(34, 0, 10, 0x11, 0x80),
	PIN(35, 0, 11, 0x11, 0x80),
	PIN(36, 0, 12, 0x11, 0x80),
	PIN(37, 0, 13, 0x11, 0x80),
	PIN(38, 0, 14, 0x11, 0x80),
	PIN(39, 0, 6, 0x18, 0x90),
	PIN(40, 0, 3, 0x18, 0x90),
	PIN(41, 0, 5, 0x18, 0x90),
	PIN(42, 0, 4, 0x18, 0x90),
	PIN(43, 0, 7, 0x18, 0x90),
	PIN(44, 0, 8, 0x18, 0x90),
	PIN(45, 0, 9, 0x18, 0x90),
	PIN(46, 0, 10, 0x18, 0x90),
	PIN(47, 0, 13, 0x18, 0x90),
	PIN(48, 0, 11, 0x18, 0x90),
	PIN(49, 0, 14, 0x18, 0x90),
	PIN(50, 0, 12, 0x18, 0x90),
	PIN(51, 0, 15, 0x18, 0x90),
	PIN(52, 0, 7, 0x29, 0xa0),
	PIN(53, 0, 8, 0x29, 0xa0),
	PIN(54, 0, 2, 0x29, 0xa0),
	PIN(55, 0, 1, 0x29, 0xa0),
	PIN(56, 0, 5, 0x29, 0xa0),
	PIN(57, 0, 6, 0x29, 0xa0),
	PIN(58, 0, 3, 0x29, 0xa0),
	PIN(59, 0, 4, 0x29, 0xa0),
	PIN(60, 1, 0, 0x29, 0xb0),
	PIN(61, 0, 10, 0x29, 0xa0),
	PIN(62, 0, 9, 0x29, 0xa0),
	PIN(63, 0, 18, 0x29, 0xa0),
	PIN(64, 0, 0, 0x29, 0xa0),
	PIN(65, 0, 11, 0x29, 0xa0),
	PIN(66, 0, 24, 0x29, 0xa0),
	PIN(67, 0, 21, 0x29, 0xa0),
	PIN(68, 0, 20, 0x29, 0xa0),
	PIN(69, 0, 25, 0x29, 0xa0),
	PIN(70, 0, 16, 0x29, 0xa0),
	PIN(71, 0, 15, 0x29, 0xa0),
	PIN(72, 0, 23, 0x29, 0xa0),
	PIN(73, 0, 19, 0x29, 0xa0),
	PIN(74, 0, 17, 0x29, 0xa0),
	PIN(75, 0, 2, 0x1a, 0x80),
	PIN(76, 0, 3, 0x1a, 0x80),
	PIN(77, 0, 4, 0x1a, 0x80),
	PIN(78, 0, 5, 0x1a, 0x80),
	PIN(79, 0, 0, 0x1a, 0x80),
	PIN(80, 0, 1, 0x1a, 0x80),
	PIN(81, 0, 9, 0x1b, 0x70),
	PIN(82, 0, 10, 0x1b, 0x70),
	PIN(83, 0, 12, 0x1b, 0x70),
	PIN(84, 0, 11, 0x1b, 0x70),
	PIN(85, 0, 13, 0x1b, 0x70),
	PIN(86, 0, 14, 0x1b, 0x70),
	PIN(87, 0, 16, 0x1b, 0x70),
	PIN(88, 0, 15, 0x1b, 0x70),
	PIN(89, 0, 0, 0x1b, 0x70),
	PIN(90, 0, 8, 0x1b, 0x70),
	PIN(91, 0, 6, 0x1c, 0x80),
	PIN(92, 0, 7, 0x1c, 0x80),
	PIN(93, 0, 8, 0x1c, 0x80),
	PIN(94, 0, 4, 0x1c, 0x80),
	PIN(95, 0, 1, 0x1c, 0x80),
	PIN(96, 0, 3, 0x1c, 0x80),
	PIN(97, 0, 2, 0x1c, 0x80),
	PIN(98, 0, 5, 0x1c, 0x80),
	PIN(99, 0, 9, 0x1c, 0x80),
	PIN(100, 0, 12, 0x1c, 0x80),
	PIN(101, 0, 10, 0x1c, 0x80),
	PIN(102, 0, 13, 0x1c, 0x80),
	PIN(103, 0, 0, 0x1c, 0x80),
	PIN(104, 0, 11, 0x1c, 0x80),
	PIN(105, 0, 14, 0x1c, 0x80),
	PIN(106, 0, 0, 0x15, 0x80),
	PIN(107, 0, 1, 0x15, 0x80),
	PIN(108, 0, 3, 0x15, 0x80),
	PIN(109, 0, 2, 0x15, 0x80),
	PIN(110, 0, 4, 0x15, 0x80),
	PIN(111, 0, 5, 0x15, 0x80),
	PIN(112, 0, 7, 0x15, 0x80),
	PIN(113, 0, 6, 0x15, 0x80),
	PIN(114, 0, 8, 0x15, 0x80),
	PIN(115, 0, 9, 0x15, 0x80),
	PIN(116, 0, 11, 0x15, 0x80),
	PIN(117, 0, 10, 0x15, 0x80),
	PIN(118, 0, 9, 0x26, 0x90),
	PIN(119, 0, 10, 0x26, 0x90),
	PIN(120, 0, 12, 0x26, 0x90),
	PIN(121, 0, 11, 0x26, 0x90),
	PIN(122, 0, 0, 0x26, 0x90),
	PIN(123, 0, 7, 0x26, 0x90),
	PIN(124, 0, 8, 0x26, 0x90),
	PIN(125, 1, 0, 0x17, 0x80),
	PIN(126, 1, 1, 0x17, 0x80),
	PIN(127, 1, 2, 0x17, 0x80),
	PIN(128, 1, 3, 0x17, 0x80),
	PIN(129, 1, 4, 0x17, 0x80),
	PIN(130, 1, 5, 0x17, 0x80),
	PIN(131, 1, 9, 0x17, 0x80),
	PIN(132, 1, 11, 0x17, 0x80),
	PIN(133, 1, 10, 0x17, 0x80),
	PIN(134, 1, 6, 0x17, 0x80),
	PIN(135, 1, 8, 0x17, 0x80),
	PIN(136, 1, 7, 0x17, 0x80),
	PIN(137, 1, 10, 0x14, 0x70),
	PIN(138, 1, 11, 0x14, 0x70),
	PIN(139, 1, 12, 0x14, 0x70),
	PIN(140, 1, 13, 0x14, 0x70),
	PIN(141, 1, 14, 0x14, 0x70),
	PIN(142, 1, 15, 0x14, 0x70),
	PIN(143, 1, 16, 0x14, 0x70),
	PIN(144, 1, 17, 0x14, 0x70),
	PIN(145, 1, 0, 0x14, 0x70),
	PIN(146, 1, 1, 0x14, 0x70),
	PIN(147, 1, 2, 0x14, 0x70),
	PIN(148, 1, 3, 0x14, 0x70),
	PIN(149, 1, 4, 0x14, 0x70),
	PIN(150, 1, 5, 0x14, 0x70),
	PIN(151, 1, 6, 0x14, 0x70),
	PIN(152, 1, 7, 0x14, 0x70),
	PIN(153, 1, 9, 0x14, 0x70),
	PIN(154, 1, 8, 0x14, 0x70),
	PIN(155, 1, 18, 0x14, 0x70),
	PIN(156, 1, 19, 0x14, 0x70),
	PIN(157, 0, 1, 0x12, 0x80),
	PIN(158, 0, 2, 0x12, 0x80),
	PIN(159, 0, 0, 0x12, 0x80),
	PIN(160, 0, 22, 0x13, 0x80),
	PIN(161, 0, 20, 0x13, 0x80),
	PIN(162, 0, 23, 0x13, 0x80),
	PIN(163, 0, 21, 0x13, 0x80),
	PIN(164, 0, 12, 0x13, 0x80),
	PIN(165, 0, 14, 0x13, 0x80),
	PIN(166, 0, 13, 0x13, 0x80),
	PIN(167, 0, 15, 0x13, 0x80),
	PIN(168, 0, 16, 0x13, 0x80),
	PIN(169, 0, 17, 0x13, 0x80),
	PIN(170, 0, 19, 0x13, 0x80),
	PIN(171, 0, 18, 0x13, 0x80),
	PIN(172, 0, 10, 0x13, 0x80),
	PIN(173, 0, 11, 0x13, 0x80),
	PIN(174, 0, 15, 0x11, 0x80),
	PIN(175, 0, 16, 0x11, 0x80),
	PIN(176, 0, 17, 0x11, 0x80),
	PIN(177, 0, 18, 0x11, 0x80),
	PIN(178, 0, 6, 0x11, 0x80),
	PIN(179, 0, 7, 0x11, 0x80),
	PIN(180, 0, 0, 0x11, 0x80),
	PIN(181, 0, 1, 0x11, 0x80),
	PIN(182, 0, 2, 0x11, 0x80),
	PIN(183, 0, 3, 0x11, 0x80),
	PIN(184, 0, 4, 0x11, 0x80),
	PIN(185, 0, 5, 0x11, 0x80),
	PIN(186, 0, 4, 0x1d, 0xc0),
	PIN(187, 0, 5, 0x1d, 0xc0),
	PIN(188, 0, 12, 0x1d, 0xc0),
	PIN(189, 0, 17, 0x1d, 0xc0),
	PIN(190, 0, 13, 0x1d, 0xc0),
	PIN(191, 0, 18, 0x1d, 0xc0),
	PIN(192, 0, 0, 0x1d, 0xc0),
	PIN(193, 0, 6, 0x1d, 0xc0),
	PIN(194, 0, 14, 0x1d, 0xc0),
	PIN(195, 0, 19, 0x1d, 0xc0),
	PIN(196, 0, 1, 0x1d, 0xc0),
	PIN(197, 0, 7, 0x1d, 0xc0),
	PIN(198, 0, 15, 0x1d, 0xc0),
	PIN(199, 0, 20, 0x1d, 0xc0),
	PIN(200, 0, 22, 0x1d, 0xc0),
	PIN(201, 0, 25, 0x1d, 0xc0),
	PIN(202, 0, 16, 0x1d, 0xc0),
	PIN(203, 0, 21, 0x1d, 0xc0),
	PIN(204, 0, 2, 0x1d, 0xc0),
	PIN(205, 0, 3, 0x1d, 0xc0),
	PIN(206, 0, 8, 0x1d, 0xc0),
	PIN(207, 0, 9, 0x1d, 0xc0),
	PIN(208, 0, 10, 0x1d, 0xc0),
	PIN(209, 0, 11, 0x1d, 0xc0),
	PIN(210, 0, 0, 0x2e, 0x90),
	PIN(211, 0, 1, 0x2e, 0x90),
	PIN(212, 0, 2, 0x2e, 0x90),
	PIN(213, 0, 3, 0x2e, 0x90),
	PIN(214, 0, 23, 0x1d, 0xc0),
	PIN(215, 0, 24, 0x1d, 0xc0),
	PIN(216, 0, 4, 0x2e, 0x90),
	PIN(217, 1, 1, 0x2e, 0xa0),
	PIN(218, 1, 2, 0x2e, 0xa0),
	PIN(219, 1, 0, 0x2e, 0xa0),
	PIN(220, 0, 5, 0x2e, 0x90),
	PIN(221, 0, 6, 0x2e, 0x90),
	PIN(222, 0, 8, 0x2e, 0x90),
	PIN(223, 0, 7, 0x2e, 0x90),
	PIN(224, 1, 3, 0x2e, 0xa0),
	PIN(225, 1, 4, 0x2e, 0xa0),
	PIN(226, 1, 5, 0x2e, 0xa0),
	PIN(227, 1, 6, 0x2e, 0xa0),
	PIN(228, 1, 7, 0x2e, 0xa0),
	PIN(229, 1, 8, 0x2e, 0xa0),
	PIN(230, 0, 13, 0x2f, 0x70),
	PIN(231, 0, 14, 0x2f, 0x70),
	PIN(232, 0, 10, 0x2f, 0x70),
	PIN(233, 0, 0, 0x2f, 0x70),
	PIN(234, 0, 3, 0x2f, 0x70),
	PIN(235, 0, 1, 0x2f, 0x70),
	PIN(236, 0, 2, 0x2f, 0x70),
	PIN(237, 0, 6, 0x2f, 0x70),
	PIN(238, 0, 5, 0x2f, 0x70),
	PIN(239, 0, 19, 0x2f, 0x70),
	PIN(240, 0, 18, 0x2f, 0x70),
	PIN(241, 0, 16, 0x2f, 0x70),
	PIN(242, 0, 17, 0x2f, 0x70),
	PIN(243, 0, 15, 0x2f, 0x70),
	PIN(244, 0, 12, 0x2f, 0x70),
	PIN(245, 0, 9, 0x2f, 0x70),
	PIN(246, 0, 8, 0x2f, 0x70),
	PIN(247, 0, 7, 0x2f, 0x70),
	PIN(248, 0, 4, 0x2f, 0x70),
	PIN(249, 0, 20, 0x2f, 0x70),
	PIN(250, 0, 11, 0x2f, 0x70),
	PIN(251, 0, 2, 0x13, 0x80),
	PIN(252, 0, 3, 0x13, 0x80),
	PIN(253, 0, 4, 0x13, 0x80),
	PIN(254, 0, 5, 0x13, 0x80),
	PIN(255, 0, 6, 0x13, 0x80),
	PIN(256, 0, 7, 0x13, 0x80),
	PIN(257, 0, 8, 0x13, 0x80),
	PIN(258, 0, 9, 0x13, 0x80),
	PIN(259, 1, 9, 0x2e, 0xa0),
	PIN(260, 1, 10, 0x2e, 0xa0),
	PIN(261, 1, 11, 0x2e, 0xa0),
	PIN(262, 1, 12, 0x2e, 0xa0),
	PIN(263, 1, 13, 0x2e, 0xa0),
	PIN(264, 1, 14, 0x2e, 0xa0),
	PIN(265, 1, 15, 0x2e, 0xa0),
	PIN(266, 1, 16, 0x2e, 0xa0),
	PIN(267, 1, 2, 0x2f, 0x80),
	PIN(268, 1, 3, 0x2f, 0x80),
	PIN(269, 1, 0, 0x2f, 0x80),
	PIN(270, 1, 1, 0x2f, 0x80),
};

#endif /* MT_GPIO_H */
